<script setup lang="ts">
/**
 * 智慧医疗平台主应用组件
 * 提供路由视图容器
 */
</script>

<template>
  <div id="app">
    <!-- 手机外框容器 -->
    <div class="phone-container">
      <div class="phone-frame">
        <!-- 音量按钮 -->
        <div class="volume-up"></div>
        <div class="volume-down"></div>
        
        <!-- 手机屏幕区域 -->
        <div class="phone-screen">
          <!-- 路由视图容器 -->
          <router-view />
        </div>
      </div>
    </div>
  </div>
</template>

<style>
/* 全局样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* 防止内容溢出 */
  max-width: 100%;
}

/* 确保所有元素都不会溢出手机屏幕 */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: #f7f8fa;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

/* 手机外框容器 */
.phone-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 手机外框样式 */
.phone-frame {
  width: 375px;
  height: 812px;
  background: #1a1a1a;
  border-radius: 40px;
  padding: 8px;
  box-shadow: 
    0 0 0 2px #333,
    0 0 0 6px #1a1a1a,
    0 20px 40px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.1);
  position: relative;
}

/* 手机顶部刘海 */
.phone-frame::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 28px;
  background: #1a1a1a;
  border-radius: 0 0 20px 20px;
  z-index: 10;
}

/* 手机屏幕区域 */
.phone-screen {
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 32px;
  overflow-x: hidden; /* 只隐藏横向滚动 */
  overflow-y: auto;   /* 允许纵向滚动 */
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
  /* 确保内容不会溢出手机屏幕 */
  max-width: 100%;
  max-height: 100%;
  /* 强制限制所有子元素在容器内 */
  contain: layout style paint;
  isolation: isolate;
}

/* 全局弹窗样式 - 确保所有弹窗都在手机屏幕内 */
.phone-screen :deep(.van-popup),
.phone-screen :deep(.van-overlay) {
  position: absolute !important;
  max-width: 100% !important;
  max-height: 100% !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  margin: 0 !important;
  transform: none !important;
}

/* 手机按钮 */
.phone-frame::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 120px;
  width: 3px;
  height: 60px;
  background: #333;
  border-radius: 2px;
}

/* 音量按钮 */
.phone-frame {
  position: relative;
}

.phone-frame .volume-up,
.phone-frame .volume-down {
  position: absolute;
  left: -3px;
  width: 3px;
  background: #333;
  border-radius: 2px;
}

.phone-frame .volume-up {
  top: 100px;
  height: 30px;
}

.phone-frame .volume-down {
  top: 140px;
  height: 30px;
}

/* 移动端适配 */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  
  #app {
    padding: 10px;
  }
  
  .phone-frame {
    width: 350px;
    height: 700px;
    border-radius: 35px;
  }
  
  .phone-screen {
    border-radius: 28px;
  }
}

@media (max-width: 400px) {
  #app {
    padding: 5px;
  }
  
  .phone-frame {
    width: 320px;
    height: 640px;
    border-radius: 30px;
  }
  
  .phone-screen {
    border-radius: 24px;
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
</style>
